//2009/08/22 20:55:16
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class OptimalList
{
public:
    string optimize(string inst)
    {
		int cnt1 = 0;
		int cnt2 = 0;
		string s;
		for(int i=0; i<inst.size(); i++)
		{
			if(inst[i] == 'N') cnt1++;
			else if(inst[i] == 'S') cnt1--;
			else if(inst[i] == 'E') cnt2++;
			else if(inst[i] == 'W') cnt2--;
		}
		if(cnt2 > 0)
		{
			string temp (abs(cnt2), 'E');
			s += temp;
		}
		if(cnt1 > 0)
		{
			string temp(abs(cnt1), 'N');
			s += temp;
		}
		if(cnt1 < 0)
		{
			string temp(abs(cnt1), 'S');
			s += temp;
		}
		if(cnt2 < 0)
		{
			string temp (abs(cnt2), 'W');
			s += temp;
		}
		return s;
    }
};
